home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / console / svgatext.3 / svgatext / SVGATextMode-1.3 / contrib / scripts / STMmenu < prev   
Encoding:
Text File  |  1995-11-17  |  1.5 KB  |  73 lines

  1. #!/bin/sh
  2. #
  3. # This script uses the "scan" mode from SVGATextMode to construct a list of all 
  4. # modes allowed for your setup, and then displays a "dialog" box which lets
  5. # you select a mode, and program it.
  6. #
  7. # Created by Wouter Gadeyne
  8. #
  9.  
  10. if [ "_$1" = "_-h" ]; then
  11.     echo
  12.     echo "\`$0' is a dialog script that will show a menu of all"
  13.     echo "SVGATextMode modes that are allowed on your set-up,"
  14.     echo "and let you pick one to program."
  15.     echo
  16.     echo " usage: $0 [options]"
  17.     echo
  18.     echo "    options:"
  19.     echo "      -h  show this help message"
  20.     echo "      -b  \"browse\" mode: the menu will re-appear each time you"
  21.     echo "          selected a mode, until you choose \`cancel' from the menu"
  22.     echo
  23.     exit
  24. fi
  25.  
  26. STM=/usr/sbin/SVGATextMode
  27.  
  28. ModeDB=`$STM -s | awk '{ printf("%s \"%10s %8s %6s %18s\" "),$1,$3,$5,$7,$9}' `
  29.  
  30. select_mode() {
  31.   MODE=`eval "dialog --title 'SVGATextMode: select a TextMode' \
  32.                      --menu 'Mode             Clock     screen  font    Refresh       ' 24 80 17 $ModeDB" \
  33.   3>&1 1>&2 2>&3 `
  34.  
  35.   #
  36.   # Let SVGATextMode process the mode, and show the parameters
  37.   # Then ask if this mode should be programmed
  38.   #
  39.  
  40.   if [ $? = 0 ]; then
  41.  
  42.     MODEDATA=`$STM -n $MODE`
  43.  
  44.     dialog --title "SVGATextMode: program \"$MODE\" mode?" \
  45.            --yesno "$MODEDATA" 7 70
  46.     #
  47.     # Now program the mode, if the answer was "yes"
  48.     #
  49.  
  50.     if [ $? = 0 ]; then
  51.         $STM $MODE
  52.     else
  53.         exit
  54.     fi
  55.   else
  56.       exit
  57.   fi
  58. }
  59.  
  60. #
  61. # main 
  62. #
  63.  
  64. if [ "_$1" = "_-b" ]; then
  65.     while true; do
  66.         select_mode
  67.     done
  68. else
  69.     select_mode
  70. fi
  71.  
  72.